You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[#619] Remove the hierarchy flag from Config Setup - #704
Removes the hierarchy flag of Quantum\Config\Setup, deprecated in 3.1.2 (#618): the $hierarchical constructor argument, setHierarchy() and getHierarchy(). A module's config file that does not exist always falls back to shared/config.
Setup::__construct() is now ($pathPrefix, $fileName, $module, $exceptionMessage).
ConfigFileTrait::resolveFilePath() no longer checks the flag before the shared fallback.
Why
Nothing in the framework turned the fallback off, and turning it off broke the loading of the global config in shared/config, which is found only through the fallback. 3.1.2 deprecated the flag and announced its removal in 3.2.0.
Breaking
The module and the exception message move up one position: new Setup('config', 'app', true, 'Admin') must become new Setup('config', 'app', module: 'Admin'). In a file that declares strict_types, the old call fails with a TypeError; without it, PHP turns true into the module 1 and false into no module, and the module name becomes the exception message, so the config is read from shared or from the wrong module without an error. Calls that pass only the first two arguments, or the module as a named argument, are unaffected. setHierarchy() and getHierarchy() are gone.
New tests in SetupTest fail without the change: testThirdArgumentIsTheModule (the module was null), testFourthArgumentIsTheExceptionMessage (the module was the message) and testHierarchyMethodsAreRemoved.
The tests that passed the flag positionally now pass the module as a named argument, or nothing. They passed on the old code with that change, and pass after it; testImportFallsBackToSharedConfig covers the fallback for a module without its own file.
The tests of the removed API are deleted: testSetGetHierarchy, the three deprecation tests that passed the flag, and testImportDoesNotFallBackWhenHierarchyIsDisabled.
Summary by CodeRabbit
Breaking Changes
Removed the configuration hierarchy option and its related methods. Update constructor calls to the new argument order; use the named module argument when specifying a module.
Bug Fixes
Configuration lookup now checks the shared configuration path when a module-specific file is missing, regardless of hierarchy settings.
Documentation
Added migration guidance covering the updated constructor arguments and the behavior of legacy positional calls.
No actionable comments were generated in the recent review.
Walkthrough
Setup removes its hierarchy flag and methods. When the initial configuration path is missing, lookup now checks the shared configuration path. Tests and the changelog reflect the constructor and fallback changes.
Changes: Configuration setup and resolution
Layer / File(s)
Summary
Remove the hierarchy API src/Config/Setup.php, tests/Unit/Config/SetupTest.php, tests/Unit/Database/*, tests/Unit/Migration/*, tests/Unit/Validation/Traits/*, CHANGELOG.md
Setup removes the hierarchy property, constructor argument, and methods. Tests and database setup callers use the revised constructor arguments. The changelog documents the breaking change.
Use shared configuration fallback src/Config/Traits/ConfigFileTrait.php, tests/Unit/Config/ConfigTest.php
When the initial configuration path is missing, lookup checks the shared path without a hierarchy check. Configuration tests use the named module argument and remove the test that expected fallback to be disabled.
Change: Refactor · Severity of issue fixed: Medium
Possibly related issues
Issue 649 describes a broader configuration resolution flow that includes the shared fallback changed here. Its package-default and config:publish objectives are not addressed by this change.
Suggested reviewers:andrey-smaelov, artem-dev2
Merge Risk: Minimal · up to 9386a
Setup no longer takes a hierarchy flag, and a missing module config file now always falls back to the shared config. Callers that pass the module positionally must switch to the named module argument, and the changelog explains how. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "[#619] Remove the hierarchy flag from Config Setup" matches the main change. The changeset removes the $hierarchical constructor parameter, setHierarchy() and getHierarchy() from Quantum\Co…
Linked Issues check
Directly linked issue #619 has coding requirements. The PR meets them.
[Removal of the hierarchy flag] The PR removes the $hierarchical constructor parameter from Setup, plus setHierarchy() and…
Out of Scope Changes check
All changed paths relate to #619. src/Config/Setup.php and src/Config/Traits/ConfigFileTrait.php implement the removal and the unconditional fallback. CHANGELOG.md documents the breaking change.…
Full details: Title check
Explanation
The title "[#619] Remove the hierarchy flag from Config Setup" matches the main change. The changeset removes the $hierarchical constructor parameter, setHierarchy() and getHierarchy() from Quantum\Config\Setup, and makes the shared fallback unconditional in ConfigFileTrait. The title names the removed flag and the affected class, and it cites linked issue #619. It does not mention the fallback behavior change or the breaking constructor argument shift, but it does not need to cover every detail.
Full details: Linked Issues check
Explanation
Directly linked issue #619 has coding requirements. The PR meets them.
[Removal of the hierarchy flag] The PR removes the $hierarchical constructor parameter from Setup, plus setHierarchy() and getHierarchy(). The new constructor is ($pathPrefix, $fileName, $module, $exceptionMessage). The summary confirms this at the reviewed head.
[Unconditional shared fallback] ConfigFileTrait::resolveFilePath() no longer checks the flag before the shared fallback. The summary confirms this change.
[Tests] SetupTest adds testThirdArgumentIsTheModule, testFourthArgumentIsTheExceptionMessage, and testHierarchyMethodsAreRemoved. The tests that used the old positional flag now use the named module argument. testImportFallsBackToSharedConfig covers the fallback for a module without its own file. The summary does not show a test that asserts the fallback directly for a module with no file. The existing fallback test is assumed to cover it.
[Changelog] CHANGELOG.md documents the breaking signature change with migration guidance. This meets the changelog part of the documentation criterion.
Non-coding gaps: the changed-path list does not include the upgrade guide or the sentence in advanced-features/configuration.md. The issue asks for both. Documentation edits and the report of composer command results are non-coding tasks. They do not change this coding verdict.
Full details: Out of Scope Changes check
Explanation
All changed paths relate to #619. src/Config/Setup.php and src/Config/Traits/ConfigFileTrait.php implement the removal and the unconditional fallback. CHANGELOG.md documents the breaking change. The test files tests/Unit/Config/SetupTest.php and tests/Unit/Config/ConfigTest.php cover the new behavior. The tests DatabaseTest, TableFactoryTest, MigrationManagerTest, and GeneralRuleTest changed only one call each. Those calls stopped passing the removed positional true. These edits are needed because the constructor signature changed. No unrelated change appears in the summary.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #619
What
Removes the hierarchy flag of
Quantum\Config\Setup, deprecated in 3.1.2 (#618): the$hierarchicalconstructor argument,setHierarchy()andgetHierarchy(). A module's config file that does not exist always falls back toshared/config.Setup::__construct()is now($pathPrefix, $fileName, $module, $exceptionMessage).ConfigFileTrait::resolveFilePath()no longer checks the flag before the shared fallback.Why
Nothing in the framework turned the fallback off, and turning it off broke the loading of the global config in
shared/config, which is found only through the fallback. 3.1.2 deprecated the flag and announced its removal in 3.2.0.Breaking
The module and the exception message move up one position:
new Setup('config', 'app', true, 'Admin')must becomenew Setup('config', 'app', module: 'Admin'). In a file that declaresstrict_types, the old call fails with aTypeError; without it, PHP turnstrueinto the module1andfalseinto no module, and the module name becomes the exception message, so the config is read fromsharedor from the wrong module without an error. Calls that pass only the first two arguments, or the module as a named argument, are unaffected.setHierarchy()andgetHierarchy()are gone.Changed paths
src/Config/Setup.phpsrc/Config/Traits/ConfigFileTrait.phptests/Unit/Config/SetupTest.php,tests/Unit/Config/ConfigTest.phptests/Unit/Database/DatabaseTest.php,tests/Unit/Database/Factories/TableFactoryTest.php,tests/Unit/Migration/MigrationManagerTest.php,tests/Unit/Validation/Traits/GeneralRuleTest.phpCHANGELOG.mdTesting
SetupTestfail without the change:testThirdArgumentIsTheModule(the module wasnull),testFourthArgumentIsTheExceptionMessage(the module was the message) andtestHierarchyMethodsAreRemoved.testImportFallsBackToSharedConfigcovers the fallback for a module without its own file.testSetGetHierarchy, the three deprecation tests that passed the flag, andtestImportDoesNotFallBackWhenHierarchyIsDisabled.Summary by CodeRabbit
moduleargument when specifying a module.